import {RouterModule, Routes} from "@angular/router";
import {NgModule} from "@angular/core";
import {LostorfindsComponent} from "./lostorfinds/lostorfinds.component";
import {FindComponent} from "./find/find.component";
import {LostComponent} from "./lost/lost.component";
import {UploadComponent} from "./upload/upload.component";
import {AccountComponent} from "./account/account.component";
import {MyUploadsComponent} from "./my-uploads/my-uploads.component";
import {AuthGuard} from "../services";
import {DetailComponent} from "./detail/detail.component";

const routes: Routes = [
  {
    path: "", component: LostorfindsComponent,
    children: [
      {
        path: "", component: FindComponent,
      },
      {
        path: "find", component: FindComponent
      },
      {
        path: "lost", component: LostComponent
      },
      {
        path: "upload", component: UploadComponent,
        canActivate: [
          AuthGuard
        ]
      },
      {
        path: 'detail/:id', component: DetailComponent
      },
      {
        path: "account", component: AccountComponent
      },
      {
        path: "me", component: MyUploadsComponent
      }
    ]
  }
]
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class ComponentsRoutingModule{

}
